{% extends "base.html" %}

{% block content %}
<h2>Praktyki</h2>
{% if user.get_profile.is_teacher %}
<a href="/trainings/lock_all/">Zablokuj wszystkie</a> | <a href="/trainings/unlock_all/">Odblokuj wszystkie</a> | <a href="/trainings/switch_all/">Przełącz wszystkie</a> 
{% endif %}
<table>
    <thead><tr>
        <th>Nazwisko</th>
        <th>Imię</th>
        <th>Firma</th>
        <th>Daty trwania</th>
        <th>Aka-<br>demik?</th>
        <th>Płatna?</th>
        <th>Zagra-<br>niczna?</th>
        <th></th>
        <th>Ocena</th>
    </tr></thead>
{% for training in trainings %}
    <tr>
        <td><a href="/students/show/{{ training.student.id }}/">{{ training.student.profile.user.last_name }}</a></td>
        <td><a href="/students/show/{{ training.student.id }}/">{{ training.student.profile.user.first_name }}</a></td>
        <td>{% firstof training.branch "n/d" %}</td>
        <td>{% firstof training.training_date "n/d" %}</td>
        <td>{% if training.hostel %} tak {% else %} nie {% endif %}</td>
        <td>{% if training.payable %} tak {% else %} nie {% endif %}</td>
        <td>{% if training.abroad %} tak {% else %} nie {% endif %}</td>
        <td>
            <a href="/trainings/show/{{ training.id }}/">Pokaż</a> <br/>
            <a href="/trainings/edit/{{ training.id }}/">Edytuj</a> <br/>
        {% if training.locked %}
            <a href="/trainings/unlock/{{ training.id }}/">Odblokuj</a>
        {% else %}
            <a href="/trainings/lock/{{ training.id }}/">Zablokuj</a>
        {% endif %}
        </td>
        {% if training.pass_date %}
        <td>{% firstof training.mark "Zal" %}<br/><a href="/trainings/mark/{{ training.id }}/">zmień</a></td>
        {% else %}
        <td><a href="/trainings/mark/{{ training.id }}/">Oceń</a></td>
        {% endif %}
    </tr>
{% endfor %}
</table>
{% endblock %}

